//
//  TabBarViewController.swift
//  MySwiftProject
//
//  Created by 蓓蕾 on 2021/11/11.
//

import UIKit

class TabBarViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        initTabBarController();
        // Do any additional setup after loading the view.
    }
    func initTabBarController()
    {
        let homeVC = HomeViewController()
        let homeItem : UITabBarItem = UITabBarItem(title: "首页", image: UIImage.init(named: "tai_normal")?.withRenderingMode(.alwaysOriginal), selectedImage: UIImage.init(named: "tai_selece")?.withRenderingMode(.alwaysOriginal))
        homeVC.navigationItem.title = "首页"
        homeVC.tabBarItem = homeItem
        let homeNav = UINavigationController(rootViewController: homeVC)
        
        let messageVC = MessageViewController()
        let messageItem : UITabBarItem = UITabBarItem(title: "消息", image: UIImage.init(named: "plan_normal")?.withRenderingMode(.alwaysOriginal), selectedImage: UIImage.init(named: "plan_select")?.withRenderingMode(.alwaysOriginal))
        messageVC.navigationItem.title = "消息"
        messageVC.tabBarItem = messageItem
        let messageNav = UINavigationController(rootViewController: messageVC)
        
        let myVC = MyViewController()
        let myItem : UITabBarItem = UITabBarItem(title: "我", image: UIImage.init(named: "ic_my_normal")?.withRenderingMode(.alwaysOriginal), selectedImage: UIImage.init(named: "ic_my_select")?.withRenderingMode(.alwaysOriginal))
        myVC.navigationItem.title = "个人中心"
        myVC.tabBarItem = myItem
        let myNav = UINavigationController(rootViewController: myVC)
        
        let tabBarControllers = [homeNav,messageNav,myNav]
        self.viewControllers = tabBarControllers;
        
    }

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
